<template>
	<view>
		<view class="record-box">
			<view class="item-search">
				<u-search ref="search" class="search-input" placeholder="请输入关键字"  v-model="searchText" :showAction="false" :clearabled="false" @change="fnQuery" @search="fnQuery"></u-search>
			</view>
			<!-- {{ dataList.length }} -->
			<view v-if="dataList && dataList.length > 0" style="background-color: #fff;">
				<view class="item-data" v-for="(item, index) in dataList" :key="index" @click="fnToDetail(item.id)">
					<view class="data-site" v-if="item.projectBaseType !== '基地' && item.projectBaseType !== '高端加固'">{{ item.lineSiteSectionName }}</view>
					<view class="data-site" v-if="item.projectBaseType === '基地' ||item.projectBaseType === '高端加固' ">{{ item.projectBaseName }}</view>
					<view class="data-date">
						<view>
							<u-icon name="calendar"  size="20"></u-icon>
						</view>
						<text>检查日期：{{ getDate(item.checkDate) }}</text>
					</view>
					<view class="data-user">
						<view>
							<u-icon name="clock"  size="17"></u-icon>
						</view>
						<view>
							<text>提交时间：{{ getDate3(item.recordCreateDate) }}</text>
							<text style="margin: 0 16rpx;">|</text>
							<text>{{ item.subName }}</text>
						</view>
					</view>
				</view>
			</view>
			<view v-else>
				<u-empty  mode="list" text="暂无数据"
					icon="http://cdn.uviewui.com/uview/empty/data.png">
				</u-empty>
			</view>
			<u-divider text="已加载全部数据" style="margin:0;" v-if="dataList.length >= total && dataList.length >0"></u-divider>
		</view>
	</view>

</template>
<script>
	import mixins from "@/utils/mixins.js"
	export default {
		name: 'production_record',
		mixins: [mixins],
		props: {
			dataList:{
				type: Array,
				default: () => {
					return []
				}
			},
			total:{
				type:Number,
				default:0
			}
		},
		data() {
			return {
				searchText:null,
			}
		},
		methods: {
			fnToDetail(id) {
				uni.navigateTo({
					url:`/subpackage-plasmosafety/pages/qualitySafetyManagement/production/detail_index?id=${id}`
				})
			},
			fnQuery(val) {
				this.searchText = val
				this.$emit('queryByField',val)
			},
			fnClear(val) {
				if(!val) {
					this.searchText = null
					this.$emit('fnClear',this.searchText)
				}
				
			},
		}
	}
</script>
<style lang="scss" scoped>
.record-box {
	background-color: #fff;
	padding: 20rpx;
	// height: 100%;
	.item-data {
		margin-top: 30rpx;
		border-bottom: 4rpx solid #f4f6f9;
		padding-bottom: 30rpx;
		.data-site {
			display: flex;
			padding: 30rpx 0;
			font-size: 32rpx;
			font-weight: bold;
			color: #22204E;
		}
		.data-date,  .data-user{
			display: flex;
			align-items: center;
			font-size: 28rpx;
			font-weight: 500;
			color: #6A819E;
		}
		.data-date {
			margin-bottom: 10rpx;
		}
		.data-user{
			margin-left:4rpx;
			font-size: 24rpx;
		}
	}
	.item-data:last-child {
		border-bottom: none;
	}
}
	/deep/ .u-search__content {
		height:88rpx
	}
</style>
